clear all


use "data/data_all.dta", replace

drop if session == 1 //dropping pilot subjects

drop if info_struct == 11 //dropping uninformative info structure special to robustness sessions.

gen main = 1

replace main = 0 if session == 4 | session == 10 | rogue == 1

gen inform = v_pred_true_all

gen info_S = info_struct == 1 | info_struct == 2 | info_struct == 5 | info_struct == 9

gen info_A = info_struct == 3 | info_struct == 4 | info_struct == 7

gen info_B = info_struct == 6 | info_struct == 8 | info_struct == 10


//Producing aggregate regressions for valuations

reg v inform asymmetry boundary , vce(cluster subj)

// a + bx = x  <=>  x = a / (1 - b)
nlcom _b[_cons] / (1 - _b[inform])


reg v inform asymmetry boundary if main == 1, vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table1.tex", tex(frag) replace
test inform = 1

reg v inform if main == 1, vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table1.tex", tex(frag)
test inform = 1

reg v inform if main == 1  & info_S == 1, vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table1.tex", tex(frag)
test inform = 1

reg v inform if main == 1 & (info_S == 1 | info_A == 1), vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table1.tex", tex(frag)
test inform = 1

reg v inform if main == 1 & (info_S == 1 | info_B == 1), vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table1.tex", tex(frag)
test inform = 1

reg v inform boundary if main == 1 & (info_S == 1 | info_B == 1), vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table1.tex", tex(frag)
test inform = 1

reg v inform asymmetry if main == 1 & (info_S == 1 | info_A == 1), vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table1.tex", tex(frag)
test inform = 1



// Referee comment: Does the half-sized urn matter?


gen reverse = 0
replace reverse = 1 if info_str == 4 | info_str == 10
replace reverse = -1 if reverse == 0 & info_S == 1

reg v inform asymmetry boundary, vce(cluster subj)
outreg2 _all using "halfSizeUrns2.tex", dec(3) tex
reg v inform asymmetry boundary reverse, vce(cluster subj)
outreg2 _all using "halfSizeUrns2.tex", dec(3) tex 

reg dev_bayes_v inform asymmetry boundary , vce(cluster subj)
outreg2 _all using "halfSizeUrns2.tex", dec(3) tex 
reg dev_bayes_v inform asymmetry boundary reverse, vce(cluster subj)
outreg2 _all using "halfSizeUrns2.tex", dec(3) tex 

reg dev_bayes_p11 inform asymmetry boundary , vce(cluster subj)
outreg2 _all using "halfSizeUrns2.tex", dec(3) tex 
reg dev_bayes_p11 inform asymmetry boundary reverse, vce(cluster subj)
outreg2 _all using "halfSizeUrns2.tex", dec(3) tex 

reg dev_bayes_p00 inform asymmetry boundary , vce(cluster subj)
outreg2 _all using "halfSizeUrns2.tex", dec(3) tex 
reg dev_bayes_p00 inform asymmetry boundary reverse, vce(cluster subj)
outreg2 _all using "halfSizeUrns2.tex", dec(3) tex








//Repeating for appendix: Includes rogue subjects, and sessions 4 and 10 (robustness sessions with modified protocol)


reg v inform asymmetry boundary if main == 1, vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table6.tex", tex(frag) replace
test inform = 1

reg v inform, vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table6.tex", tex(frag)
test inform = 1

reg v inform if info_S == 1, vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table6.tex", tex(frag)
test inform = 1

reg v inform if (info_S == 1 | info_A == 1), vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table6.tex", tex(frag)
test inform = 1

reg v inform if (info_S == 1 | info_B == 1), vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table6.tex", tex(frag)
test inform = 1

reg v inform boundary if (info_S == 1 | info_B == 1), vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table6.tex", tex(frag)
test inform = 1

reg v inform asymmetry if (info_S == 1 | info_A == 1), vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table6.tex", tex(frag)
test inform = 1



//Aggregate analysis: Relationship between information valuation and updating

//OLS
reg v v_pred if main == 1, vce(cluster subj)
test v_pred == 1

reg v v_pred asymmetry boundary if main == 1, vce(cluster subj)
outreg2 v_pred asymmetry inform boundary using "tables/table2.tex", tex(frag) replace
test v_pred == 1

//Checking first stage regression

reg v_pred inform if main == 1, vce(cluster subj)

reg v_pred inform asymmetry boundary if main == 1, vce(cluster subj)
outreg2 v_pred inform asymmetry boundary using "tables/table2.tex", tex(frag)


//2SLS

ivregress 2sls v (v_pred = inform) if main == 1, vce(cluster subj)

test v_pred == 1

ivregress 2sls v asymmetry boundary (v_pred = inform) if main == 1, vce(cluster subj)
outreg2 v_pred inform asymmetry boundary using "tables/table2.tex", tex(frag)
test v_pred == 1

//Repeating for Appendix: Relationship between information valuation and updating

//OLS
reg v v_pred, vce(cluster subj)
outreg2 v_pred asymmetry inform boundary using "tables/table7.tex", tex(frag) replace
test v_pred == 1

reg v v_pred asymmetry boundary, vce(cluster subj)
outreg2 v_pred asymmetry inform boundary using "tables/table7.tex", tex(frag)
test v_pred == 1

//Checking first stage regression

reg v_pred inform, vce(cluster subj)
outreg2 v_pred asymmetry inform boundary using "tables/table7.tex", tex(frag)

reg v_pred inform asymmetry boundary, vce(cluster subj)
outreg2 v_pred asymmetry inform boundary using "tables/table7.tex", tex(frag)


//2SLS

ivregress 2sls v (v_pred = inform), vce(cluster subj)
outreg2 v_pred asymmetry inform boundary using "tables/table7.tex", tex(frag)

test v_pred == 1

ivregress 2sls v asymmetry boundary (v_pred = inform), vce(cluster subj)
outreg2 v_pred asymmetry inform boundary using "tables/table7.tex", tex(frag)

test v_pred == 1



//Truncation analysis on full sample (for Appendix B)

replace v = 0.7 if v > 0.7 & info_struct == 1 // v_theor = 0.6
replace v = 0.9 if v > 0.9 & info_struct == 2 // v_theor = 0.7
replace v = 0.6 if v < 0.6 & (info_struct == 5 | info_struct == 6) // v_theor = 0.8
replace v = 0.7 if v < 0.7 & (info_struct == 7 | info_struct == 8) // v_theor = 0.85
replace v = 0.8 if v < 0.8 & info_struct == 9 // v_theor = 0.9
replace v = 0.9 if v < 0.9 & info_struct == 10 // v_theor = 0.95



reg v inform asymmetry boundary if main == 1, vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table10.tex", tex(frag) replace
test inform = 1

reg v inform if main == 1, vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table10.tex", tex(frag)
test inform = 1

reg v inform if main == 1  & info_S == 1, vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table10.tex", tex(frag)
test inform = 1

reg v inform if main == 1 & (info_S == 1 | info_A == 1), vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table10.tex", tex(frag)
test inform = 1

reg v inform if main == 1 & (info_S == 1 | info_B == 1), vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table10.tex", tex(frag)
test inform = 1

reg v inform boundary if main == 1 & (info_S == 1 | info_B == 1), vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table10.tex", tex(frag)
test inform = 1

reg v inform asymmetry if main == 1 & (info_S == 1 | info_A == 1), vce(cluster subj)
outreg2 inform asymmetry boundary using "tables/table10.tex", tex(frag)
test inform = 1



//Correlations of average behavior across tasks, nonrogue
pwcorr dev_bayes_v dev_bayes_cond_both if rogue == 0, sig


// deviations v v_pred 

forvalues i = 1/10 {
	gen info_stru_`i'_dummy = (info_struct == `i')
}

gen diff = v - v_pred

reg diff info_stru_*, nocons vce(cluster subj)

 


